import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { resolve } from 'path';
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni()],
  resolve: {
    // 设置文件./src路径为 @
    alias: {
      // 设置路径
      '~': path.resolve(__dirname, './'),
      // 设置别名
      '@': path.resolve(__dirname, './src'),
    },
  },
  server: {
    host: '0.0.0.0',
    hmr: true,
    proxy: {
      '/apiv2': {
        target: 'https://www.pgyer.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/apiv2/, ''),
      },
    }
  },
});
